UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E7xME8JiDh0UdGZqwfs63nC0KpmDDCSDd26GQmZsIsQ=' 
WHERE 
  key_id = '340b9ee3a72bb4323471a4c295d48e83ce336e03a97ccdc169871bd0b0afdb25' 
  AND (
    token = 'E7xME8JiDh0UdGZqwfs63nC0KpmDDCSDd26GQmZsIsQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025