UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BKpttyBg5ceg3dGQtKzpOf/BdyBcmFkNg2AVlJz+uww='
WHERE
key_id = '531e662939130d2d69708f87528464903280c528212fa8165715145cd3faf5b5'
AND (
token = 'BKpttyBg5ceg3dGQtKzpOf/BdyBcmFkNg2AVlJz+uww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)