UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gX1x7Hdrf3bZ2iihr4Hpl0wJkRcIsF9Dx7GskA864Go='
WHERE
key_id = '0a7e1fcdd540a6bc66ec8401c2b3050f46f44a7c3f7b75f7581174ba13c1fcd0'
AND (
token = 'gX1x7Hdrf3bZ2iihr4Hpl0wJkRcIsF9Dx7GskA864Go='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)