UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/6q0yQNlcc+/2d0w4PZ8WcIP+2PDzyssTC7HzhPhbsQ='
WHERE
key_id = 'a8af7c1383cd5f828eb62b68b08c158c05a29a9f4b122b6b5eeccffe1e8343c3'
AND (
token = '/6q0yQNlcc+/2d0w4PZ8WcIP+2PDzyssTC7HzhPhbsQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)