UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Oar4roNmnssVQt/SaNVG2Tl/3m2WBaGPds5OE/PupA=' 
WHERE 
  key_id = '647f470c1c38a83f30ae8fd12a45ca400c9ad210351a1d3da7f01af44a1b3959' 
  AND (
    token = '0Oar4roNmnssVQt/SaNVG2Tl/3m2WBaGPds5OE/PupA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045