UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x0Hmo7JNFHG8qPGIlX12kmTlAs4w0ccJm+AYp4AO3+g='
WHERE
key_id = 'ae0448bfb2eec08bddc8f93a162579559eb429eceebc534789cc31c6d011a2c0'
AND (
token = 'x0Hmo7JNFHG8qPGIlX12kmTlAs4w0ccJm+AYp4AO3+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)