UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pN5xbPCc7ckaWhs70X4z7DTHsso7D8i9+r7vWGvEDYY='
WHERE
key_id = '0582efb350de808a454979910d9196574811dba9722bbb267a5b61dc647c571a'
AND (
token = 'pN5xbPCc7ckaWhs70X4z7DTHsso7D8i9+r7vWGvEDYY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)