UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aDkutCY7CNIs8fcBGV9PFY1Urv2tRO9H5GQpP+3veXc='
WHERE
key_id = '1a2b01bc63ae6634dba7cf53e1432a3489657976dd685c6a2bc9b1d0889729bb'
AND (
token = 'aDkutCY7CNIs8fcBGV9PFY1Urv2tRO9H5GQpP+3veXc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)