UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3YPU+1Xy5EpR9GsM/5AEdacNsOcedPB2elVWFlp6N9I='
WHERE
key_id = '49fd58fef17111c3551d1e5a84dff6b4e159695ac9ed1f9747a3d9178003af07'
AND (
token = '3YPU+1Xy5EpR9GsM/5AEdacNsOcedPB2elVWFlp6N9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)