UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sD1PI0zGoqeb1wfHjxBRQacd9RcOG5L/jjKF+I+6y0s='
WHERE
key_id = 'cb7252707b4f9b94e13e396ec3dc9d12a2b277e46022b9baac333b36cfa6ddf2'
AND (
token = 'sD1PI0zGoqeb1wfHjxBRQacd9RcOG5L/jjKF+I+6y0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)