UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'czozqlJPqhOuH4dzAadGnXJ1VInmOAHGfqxjOd9APjU='
WHERE
key_id = 'ea9039cac8647502efc7936fbfb23d11edd39b83990a35b820463d816e2f5c55'
AND (
token = 'czozqlJPqhOuH4dzAadGnXJ1VInmOAHGfqxjOd9APjU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)