UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ge5akcULW4lE/gOKQMkoDIROPlvy4hjHW5Y6e1H9a9Y=' 
WHERE 
  key_id = '6aedb092b8b04cb2ca57b234e51b9a71471f8a9806b40e2749570188bc2a336b' 
  AND (
    token = 'ge5akcULW4lE/gOKQMkoDIROPlvy4hjHW5Y6e1H9a9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033