UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EtDRP7u094wr94qtMXgDfsTxUDN4JOUCgjCGn/SQCe4='
WHERE
key_id = 'e99b86af5e44dbf04958529c18a5b0a0958e132d138518581125cf3fdcde492b'
AND (
token = 'EtDRP7u094wr94qtMXgDfsTxUDN4JOUCgjCGn/SQCe4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)