UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TxguWbREr+BnPZqECaqU1i5SiE0emkzIfKSUBAwRy1g=' 
WHERE 
  key_id = '25bc66ff14ef5901f3d30c1e95353ac315e96c96d425d510aaad6cdafd851a44' 
  AND (
    token = 'TxguWbREr+BnPZqECaqU1i5SiE0emkzIfKSUBAwRy1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039