UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xvukrZ/BPjMbo3mkd2OPXNGPohnBNYWS3CdclSF4gOI='
WHERE
key_id = 'ba9ae45f52b6112072520f3cf931d52bf854d3ad47b63be8df535c88e9dd9f4a'
AND (
token = 'xvukrZ/BPjMbo3mkd2OPXNGPohnBNYWS3CdclSF4gOI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)