UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jrbV6xn6I2HqNBGh1Xb1qzNwXkpv0bPr+tt82+L0VIg='
WHERE
key_id = 'ad54f3b8097e8ff38f51de6a90fc3601d55ee9452da4593498f46c3cece9661a'
AND (
token = 'jrbV6xn6I2HqNBGh1Xb1qzNwXkpv0bPr+tt82+L0VIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)