UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4e1/cKX7xJhjK0rusFfPrK37ZGlrhfuhb2+rIgyX0W4='
WHERE
key_id = '89d458dc111823b1117050d28840f178a9002630861d65a69581542b85d38189'
AND (
token = '4e1/cKX7xJhjK0rusFfPrK37ZGlrhfuhb2+rIgyX0W4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)