UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0RvC8tNDjMA3jfJfzSvUSBAf+9cIfAQQwbwzGCvxqPk='
WHERE
key_id = 'e8ffefe60c86cda9af396d5e661d6e498f7503f719e00ac568fa4019bafdab40'
AND (
token = '0RvC8tNDjMA3jfJfzSvUSBAf+9cIfAQQwbwzGCvxqPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)