UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KP0VaHN7m21jlF1sbhXN1An5U7dhoRrpM6X++1YGMA4=' 
WHERE 
  key_id = '83a48645e50dc2aceea3a977742520fc198b3a5c031b4df603f8b842aad62835' 
  AND (
    token = 'KP0VaHN7m21jlF1sbhXN1An5U7dhoRrpM6X++1YGMA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026