UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jfHmuOm3VSY72My44i9oz3noVdH1FsfJg67+qMweWmk='
WHERE
key_id = 'de83532d70a78e9d0ccd5a299b91c2aa0171a13e8f1871c3615e8108d55a6cb9'
AND (
token = 'jfHmuOm3VSY72My44i9oz3noVdH1FsfJg67+qMweWmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)