UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'afyiEgw83e+jJWesfMGoXIX9aBlczqvM1Hs67QWfqOE='
WHERE
key_id = 'fac7fb69a701bbb5da0dc3f0417e348627ba6ef5142ee67ce05c4a6d60f0d6a4'
AND (
token = 'afyiEgw83e+jJWesfMGoXIX9aBlczqvM1Hs67QWfqOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)