UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6HIZG9YYuhDrqHOR19hnsd4l3se8s1HGqCTRHe7gN0M=' 
WHERE 
  key_id = 'b8e5f9a255967b4bed2afe49cc22994ea342d9467358ad2169061b15911f55bd' 
  AND (
    token = '6HIZG9YYuhDrqHOR19hnsd4l3se8s1HGqCTRHe7gN0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023