UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7hF4sYaoGrx+1bTr6vymtNj6sIs1fGrL7eP5AHG76M0='
WHERE
key_id = '27d5b949108a68b5a8e890651a89679beb336db8ecff5c16527a7e6ea7628148'
AND (
token = '7hF4sYaoGrx+1bTr6vymtNj6sIs1fGrL7eP5AHG76M0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)