UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kh7lbgNbYLbj2F/riJrUcZ9pWO5g6NsAi8OyWPELmjs='
WHERE
key_id = 'c9bc05bde03d0b1ef4b7e54a8c0b2589f6d819e729fbb932420897995710365a'
AND (
token = 'kh7lbgNbYLbj2F/riJrUcZ9pWO5g6NsAi8OyWPELmjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)