UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MJo/dEbjCBF+1B/TQjESvqjDp+wC6FitVaCIF+LePJE='
WHERE
key_id = 'c2fec316083cc1d858a9ef8069f7ba93d24131e1120e8ff0a6d67e8e9c6afdfb'
AND (
token = 'MJo/dEbjCBF+1B/TQjESvqjDp+wC6FitVaCIF+LePJE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)