UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1jBTU+aheVPM0ZQqGShuLXDh3FCbTk8gcqVgzx3B4I4='
WHERE
key_id = 'dc7dadda631db09fe09432b9d497be1d12f2136d13fa91f22b7c2774022fe68c'
AND (
token = '1jBTU+aheVPM0ZQqGShuLXDh3FCbTk8gcqVgzx3B4I4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)