UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NfhrFUMlz2V+bkL3HQ7R8gwdxnPlGQD2sWYiwNexScg='
WHERE
key_id = '27f71c1c09e08d797d37399097953e57a99f9ac47fcdb676e584d18f4fc1b9d6'
AND (
token = 'NfhrFUMlz2V+bkL3HQ7R8gwdxnPlGQD2sWYiwNexScg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)