UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NIKu/4N/eKkPPP3p/Ua29d4j16Dzyl2Cs1R1Yvq8m3Q=' 
WHERE 
  key_id = '56a04a69746e15fbbc01ab5a87b706837d8c1ae2a5ae846c8c013361f310cd85' 
  AND (
    token = 'NIKu/4N/eKkPPP3p/Ua29d4j16Dzyl2Cs1R1Yvq8m3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032