UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ymcA1+sOx3jDHYGX42w4XxVRQu+6/i3/GRbHyM/s+a4='
WHERE
key_id = '8e9648a8ffa71c739bf0fa776ba35e128839983b5453313cc573cf73d91ebb35'
AND (
token = 'ymcA1+sOx3jDHYGX42w4XxVRQu+6/i3/GRbHyM/s+a4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)