UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6yRwBZiqTWX9h7e3kdhibvEHVUhhS0ADiKCUQ/Ht2i0='
WHERE
key_id = 'c71152f48aa07b87100969be9530735517889907deeda441b2de34130f329a1a'
AND (
token = '6yRwBZiqTWX9h7e3kdhibvEHVUhhS0ADiKCUQ/Ht2i0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)